-
Notifications
You must be signed in to change notification settings - Fork 4.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Hysteria2 Protocol #2721
base: master
Are you sure you want to change the base?
Add Hysteria2 Protocol #2721
Conversation
Codecov ReportAttention:
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #2721 +/- ##
==========================================
- Coverage 37.79% 36.78% -1.01%
==========================================
Files 654 664 +10
Lines 38723 39771 +1048
==========================================
- Hits 14636 14631 -5
- Misses 22477 23524 +1047
- Partials 1610 1616 +6
☔ View full report in Codecov by Sentry. |
I had merged newest commit and fixed go-lint. |
Hi! Thanks for your contribution. Since this merge request includes switching the dependency, it will be a longer review process, however I will try my best to expatiate the process. |
Hi, after some interal discuss, it seems there is no active maintainer within V2Ray could take over the maintaince of hysteria transport. Is it possible for you to refactor this code, so that the original quic transport is left as is, and make the necessary change to make hysteria a new transport that can be disabled when something goes wrong by removing the import line in |
I am happy to merge it after the usage of forked quic from hysteria is isolated from main quic. |
Thanks. I will dig into it later. But I have been very busy lately, and I may reply very late. Anyway, I will try my best. |
Thanks, you are right. I forgot to handle that on the client side. |
建议保留brutal作为quic的一种流控算法选择,不必考虑它与hysteria的兼容性,反正hysteria已经被作为新的协议和传输层实现了。多一种选择不是坏事。 |
proxy/hysteria2/protocol.go
Outdated
return int(quicvarint.Len(uint64(s))) | ||
} | ||
|
||
func (c *ConnWriter) writeTcpHeader() error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be replaced by hyProtocol.WriteTCPRequest
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm afraid it won't work because WriteTCPRequest()
in hyProtocol executes i := VarintPut(buf, FrameTypeTCPRequest)
. However, this PR aims to separate the transport layer and the proxy layer, with FrameTypeTCPRequest
being sent by the transport layer.
proxy/hysteria2/server.go
Outdated
return newError("failed to send response").Base(err) | ||
} | ||
|
||
address := strings.Split(reqAddr, ":") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't work for IPv6. Maybe use net.SplitHostPort
instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. My bad.
func InitTLSConifg(streamSettings *internet.MemoryStreamConfig) (*hyClient.TLSConfig, error) { | ||
tlsSetting := CheckTLSConfig(streamSettings, true) | ||
if tlsSetting == nil { | ||
tlsSetting = &tls.Config{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are ConfigFromStreamSettings
and GetTLSConfig
in github.com/v2fly/v2ray-core/v5/transport/internet/tls
.
A lock is needed for By the way, identifying clients only by |
Ofcourse.
I have switched to using IP addresses to differentiate between different outbound connections. At the moment, it is indeed difficult to reuse a single port for multiple inbound connections. |
Hi, I found that the values of congestion |
My bad. Use the Brutal congestion algorithm when both |
Is that Mbps or MBps? The multiplier should be 1000*1000/8 not 1000*1000. Hysteria's case-insensitive conversation is confusing... https://github.com/apernet/hysteria/blob/master/app/internal/utils/bpsconv.go#L10-L53 |
My bad again. It should be |
Use hysteria's quic-go to support BBR and brutal congestion algorithm
Same as hysteria,
BBR
andBrutal
congestion algorithm can improve performance.Usage:
send_mbps
is needed when congestion'stype
isbrutal
, meaning the max bandwidth of current network can use to send.brutal
, it's just ok to usebbr
in both client and server side.Fix
vprotogen
bug and update all Protobuf datavprotogen
can not work, because it failed to recognize new version ofprotoc
, so that we can not add new feature to v2ray.Update go version to 1.21
fix #2701 #2644